package com.nanuminc.market.settings;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.view.Window;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Toast;

import com.nanuminc.market.R;


public class SettingSNS_ngoc extends Activity {
	
	private SharedPreferences mPref;	
	CheckBox mCb_twitter, mCb_facebook;
	private static final int twitter_request_loginweb = 1004;
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	    setContentView(R.layout.setting_sns_ngoc);
	    
	    mCb_twitter = (CheckBox) findViewById(R.id.cb_twitterset);  
	    mCb_twitter.setChecked(false); //if dont make defaut check, app automatic quit.
	    mCb_twitter.setOnCheckedChangeListener(OCCL);	
	     
	    mCb_facebook = (CheckBox) findViewById(R.id.cb_facebookset);  
	    mCb_facebook.setChecked(false); //if dont make defaut check, app automatic quit.
	    mCb_facebook.setOnCheckedChangeListener(OCCL);	
	}
	
	private OnCheckedChangeListener OCCL = new OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
		//	SharedPreferences.Editor editor = mPref.edit();
			switch (buttonView.getId()) {
			case R.id.cb_twitterset:
				if (isChecked) {
					Toast.makeText(SettingSNS_ngoc.this, "hello twitter checked", Toast.LENGTH_LONG).show();
					Intent browserIntent = 
	                    new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.twitter.com"));
				    	startActivity(browserIntent);
				} else {

				}
				break;
			case R.id.cb_facebookset:
				if(isChecked) {
					Toast.makeText(SettingSNS_ngoc.this, "hello facebook checked", Toast.LENGTH_LONG).show();
					Intent browserIntent = 
		                    new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com"));
					    	startActivity(browserIntent);
				} else {

				}
				break;
			}
		}
	};
	
}
	

